<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="model.User" %>
<jsp:useBean id="dob" class="Utils.DBUtils"/>
<%
  Object user = request.getSession().getAttribute("user");
  if (user!=null) {
    User user1 = (User)user;
%>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>修改</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="./layui/css/layui.css" tppabs="http://layui/dist/css/layui.css" media="all">
  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<style>
  body {
    background-color: lightgrey;
  }
</style>
<body>
<%
  String id = request.getParameter("id");
  String[] temp = {"title","content","share"};
  List<String[]> vec = dob.getData("classnote",temp,"id="+id,user1);
  for(int i=0;i<vec.size();i++){
    String[] ss = vec.get(i);
%>

<div style="padding: 30px;">
  <div class="layui-row layui-col-space">
    <div class="layui-col-md9">
      <div class="layui-card">
        <div class="layui-card-header">修改</div>
        <div class="layui-card-body">
          <form  name="form1" class="layui-form" method="post"  action="edit.do" lay-filter="example">
            <div class="layui-form-item">
              <label class="layui-form-label">标题</label>
              <div class="layui-input-block">
                <input type="hidden" name="id" value="<%=id%>">
                <input type="text" name="title" lay-verify="title" value="<%=ss[0] %> " required="required" class="layui-input">
              </div>
            </div>


            <div class="layui-form-item layui-form-text">
              <label class="layui-form-label">内容</label>
              <div class="layui-input-block">
                <textarea placeholder="请输入内容" class="layui-textarea" name="content" required="required" ><%=ss[1] %></textarea>
              </div>
            </div>


            <div class="layui-form-item">
              <label class="layui-form-label">是否公开</label>
              <div class="layui-input-block">

                <input type="checkbox" name="share" value="1" lay-skin="switch" lay-text="公开|私有">
                <input type="hidden" name="share" value="0" />
              </div>
            </div>



            <div class="layui-form-item">
              <div class="layui-input-block">
                <input type="submit"name="Submit"  class="layui-btn" value="提交">
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
</div>
<%}} %>






<script src="./layui/layui.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述 JS 路径需要改成你本地的 -->
<script>



  layui.use(['form', 'layedit', 'laydate'], function () {
    var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate;

    //日期
    laydate.render({
      elem: '#date'
    });
    laydate.render({
      elem: '#date1'
    });

    //创建一个编辑器
    var editIndex = layedit.build('LAY_demo_editor');


    //监听指定开关
    form.on('switch(switchTest)', function (data) {
      layer.msg('开关checked：' + (this.checked ? 'true' : 'false'), {
        offset: '6px'
      });
      layer.tips('温馨提示：请注意开关状态的文字可以随意定义，而不仅仅是ON|OFF', data.othis)
    });



    //表单取值
    layui.$('#LAY-component-form-getval').on('click', function () {
      var data = form.val('example');
      alert(JSON.stringify(data));
    });

  });
</script>

</body>
</html>
